package com.jeff.tianti.org.service;

import com.jeff.tianti.common.entity.PageModel;
import com.jeff.tianti.common.service.CommonService;
import com.jeff.tianti.org.dao.DictionaryDao;
import com.jeff.tianti.org.dto.DictionaryDTO;
import com.jeff.tianti.org.entity.Dictionary;
import org.hibernate.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DictionaryService extends CommonService<Dictionary, String> {

    @Autowired
    private DictionaryDao dictionaryDao;

    @Autowired
    public void setDictionaryDao(DictionaryDao dictionaryDao) {
        super.setCommonDao(dictionaryDao);
    }

    public PageModel<Dictionary> queryDicPage(DictionaryDTO dictionaryDTO) {
        return dictionaryDao.queryDicPage(dictionaryDTO);
    }

    public List<Dictionary> queryDicList(DictionaryDTO dictionaryDTO) {
        return dictionaryDao.queryDicList(dictionaryDTO);
    }

    public List<Dictionary> validatorCode(String code,String id) {

      return  dictionaryDao.findByCode(code,id);
    }

    public int updateSelective(Dictionary dictionary) {
      return  dictionaryDao.updateSelectiveById(dictionary);
    }
}
